libxl_json: Enable yajl_allow_trailing_garbage
authorAnthony PERARD <anthony.perard@citrix.com>
Thu, 31 May 2018 10:50:03 +0000 (11:50 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 21 Aug 2018 11:16:02 +0000 (12:16 +0100)
commit544c15c827d3ad6d4ccfb557a073fa78ca9f3ac2
tree3e0190ec9fc41e641889a1711a67a62c4d29bb7d
parente829d8bac8be98b18c16bd0f41c9530cffbf9b6a
libxl_json: Enable yajl_allow_trailing_garbage

This allows to parse a string that is not NUL-terminated. With that
option disabled, YAJL v2 would look ahead on completion to find out if
there is more to parse.

YAJL v1 doesn't have this behavior.

Any function that allocates a yajl_handle via this function either parse
a NUL-terminated string, or do provide proper length. So change the
default and allow garbage (like a different JSON document) after the end
of the data to parse.

This is important for the QMP client, as there could be more than one
message to parse, and YAJL would consider the next message to be garbage
and throw an error.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_json.h